package br.edu.fapi.gestao.pg.repositorio;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import br.edu.fapi.gestao.pg.dominio.Convenio;
import br.edu.fapi.gestao.pg.mapeador.MapeadorConvenio;

@Repository(value = "repositorioConvenio")
public class RepositorioConvenioImpl {

	@Autowired
	private JdbcTemplate jdbcTemplate;
					  
	@Resource(name = "consultasConvenio")
	private Map<String,String> sqlQueries;
	
	@Resource(name = "mapeadorConvenio")
	private MapeadorConvenio mapeadorConvenio;
	
	public List<Convenio> listarConvenios() {
		String sqlString = sqlQueries.get("listarConvenios");
		return jdbcTemplate.query(sqlString, mapeadorConvenio, new Object[] {});
	}

}
